package com.spoplar.service.impl;

import com.spoplar.dao.MerchantAlipayConfMapper;
import com.spoplar.dao.MerchantMapper;
import com.spoplar.pojo.Merchant;
import com.spoplar.pojo.MerchantAlipayConf;
import com.spoplar.service.ImerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by spoplar on 18-1-31.
 */
@Service("IMerchantService")
public class MerchantServiceImpl implements ImerchantService {

    @Autowired
    private MerchantMapper merchantMapper;
    @Autowired
    private MerchantAlipayConfMapper merchantAlipayConfMapper;

    public MerchantAlipayConf findByToken(String token) {
        int mid = merchantMapper.findMidByToken(token);

        MerchantAlipayConf merchantAlipayConf = merchantAlipayConfMapper.findByMid(mid);

        return merchantAlipayConf;
    }

    public Merchant findMerchantByToken(String token) {
        Merchant merchant = merchantMapper.findByToken(token);
        return merchant;
    }

}
